home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Overview / TESample / AUX / TESample.r < prev    next >
Encoding:
Text File  |  1994-11-18  |  7.9 KB  |  343 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware TextEdit Sample Application
  6. #
  7. #    TESample
  8. #
  9. #    TESample.r    -    Rez Source
  10. #
  11. #    Copyright ) 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Versions:    
  15. #                1.00                08/88
  16. #                1.01                11/88
  17. #                1.02                04/89
  18. #                1.03                06/89
  19. #
  20. #    Components:
  21. #                TESample.p            June 1, 1989
  22. #                TESample.c            June 1, 1989
  23. #                TESampleGlue.a        June 1, 1989    -MPW only-
  24. #                TESample.r            June 1, 1989
  25. #                TESample.h            June 1, 1989
  26. #                PTESample.make        June 1, 1989    -MPW only-
  27. #                CTESample.make        June 1, 1989    -MPW only-
  28. #                TESampleGlue.s        June 1, 1989    -A/UX only-
  29. #                TESampleAUX.r        June 1, 1989    -A/UX only-
  30. #                Makefile            June 1, 1989    -A/UX only-
  31. #
  32. #    TESample is an example application that demonstrates how 
  33. #    to initialize the commonly used toolbox managers, operate 
  34. #    successfully under MultiFinder, handle desk accessories and 
  35. #    create, grow, and zoom windows. The fundamental TextEdit 
  36. #    toolbox calls and TextEdit autoscroll are demonstrated. It 
  37. #    also shows how to create and maintain scrollbar controls.
  38. #
  39. #    It does not by any means demonstrate all the techniques you 
  40. #    need for a large application. In particular, Sample does not 
  41. #    cover exception handling, multiple windows/documents, 
  42. #    sophisticated memory management, printing, or undo. All of 
  43. #    these are vital parts of a normal full-sized application.
  44. #
  45. #    This application is an example of the form of a Macintosh 
  46. #    application; it is NOT a template. It is NOT intended to be 
  47. #    used as a foundation for the next world-class, best-selling, 
  48. #    600K application. A stick figure drawing of the human body may 
  49. #    be a good example of the form for a painting, but that does not 
  50. #    mean it should be used as the basis for the next Mona Lisa.
  51. #
  52. #    We recommend that you review this program or Sample before 
  53. #    beginning a new application. Sample is a simple app. which doesnUt 
  54. #    use TextEdit or the Control Manager.
  55. #
  56. ------------------------------------------------------------------------------*/
  57.  
  58. #include "systypes.r"
  59. #include "types.r"
  60.  
  61. #include "TESample.h"
  62.  
  63. resource 'vers' (1) {
  64.     0x02, 0x00, release, 0x00,
  65.     verUS,
  66.     "1.02",
  67.     "1.02, Copyright \251 1989 Apple Computer, Inc."
  68. };
  69.  
  70. /* we use an MBAR resource to conveniently load all the menus */
  71.  
  72. resource 'MBAR' (rMenuBar, preload) {
  73.     { mApple, mFile, mEdit };        /* three menus */
  74. };
  75.  
  76.  
  77. resource 'MENU' (mApple, preload) {
  78.     mApple, textMenuProc,
  79.     0b1111111111111111111111111111101,    /* disable dashed line, enable About and DAs */
  80.     enabled, apple,
  81.     {
  82.         "About TESample\311",
  83.             noicon, nokey, nomark, plain;
  84.         "-",
  85.             noicon, nokey, nomark, plain
  86.     }
  87. };
  88.  
  89. resource 'MENU' (mFile, preload) {
  90.     mFile, textMenuProc,
  91.     0b0000000000000000000100000000000,    /* enable Quit only, program enables others */
  92.     enabled, "File",
  93.     {
  94.         "New",
  95.             noicon, "N", nomark, plain;
  96.         "Open",
  97.             noicon, "O", nomark, plain;
  98.         "-",
  99.             noicon, nokey, nomark, plain;
  100.         "Close",
  101.             noicon, "W", nomark, plain;
  102.         "Save",
  103.             noicon, "S", nomark, plain;
  104.         "Save As\311",
  105.             noicon, nokey, nomark, plain;
  106.         "Revert",
  107.             noicon, nokey, nomark, plain;
  108.         "-",
  109.             noicon, nokey, nomark, plain;
  110.         "Page Setup\311",
  111.             noicon, nokey, nomark, plain;
  112.         "Print\311",
  113.             noicon, nokey, nomark, plain;
  114.         "-",
  115.             noicon, nokey, nomark, plain;
  116.         "Quit",
  117.             noicon, "Q", nomark, plain
  118.     }
  119. };
  120.  
  121. resource 'MENU' (mEdit, preload) {
  122.     mEdit, textMenuProc,
  123.     0b0000000000000000000000000000000,    /* disable everything, program does the enabling */
  124.     enabled, "Edit",
  125.      {
  126.         "Undo",
  127.             noicon, "Z", nomark, plain;
  128.         "-",
  129.             noicon, nokey, nomark, plain;
  130.         "Cut",
  131.             noicon, "X", nomark, plain;
  132.         "Copy",
  133.             noicon, "C", nomark, plain;
  134.         "Paste",
  135.             noicon, "V", nomark, plain;
  136.         "Clear",
  137.             noicon, nokey, nomark, plain
  138.     }
  139. };
  140.  
  141.  
  142. /* this ALRT and DITL are used as an About screen */
  143.  
  144. resource 'ALRT' (rAboutAlert, purgeable) {
  145.     {40, 20, 160, 296}, rAboutAlert, {
  146.         OK, visible, silent;
  147.         OK, visible, silent;
  148.         OK, visible, silent;
  149.         OK, visible, silent
  150.     };
  151. };
  152.  
  153. resource 'DITL' (rAboutAlert, purgeable) {
  154.     { /* array DITLarray: 5 elements */
  155.         /* [1] */
  156.         {88, 184, 108, 264},
  157.         Button {
  158.             enabled,
  159.             "OK"
  160.         },
  161.         /* [2] */
  162.         {8, 8, 24, 274},
  163.         StaticText {
  164.             disabled,
  165.             "MultiFinder-Aware TextEdit Application"
  166.         },
  167.         /* [3] */
  168.         {32, 8, 48, 237},
  169.         StaticText {
  170.             disabled,
  171.             "Copyright \251 1989 Apple Computer"
  172.         },
  173.         /* [4] */
  174.         {56, 8, 72, 136},
  175.         StaticText {
  176.             disabled,
  177.             "Brought to you by:"
  178.         },
  179.         /* [5] */
  180.         {80, 24, 112, 167},
  181.         StaticText {
  182.             disabled,
  183.             "Macintosh Developer JTechnical Support"
  184.         }
  185.     }
  186. };
  187.  
  188.  
  189. /* this ALRT and DITL are used as an error screen */
  190.  
  191. resource 'ALRT' (rUserAlert, purgeable) {
  192.     {40, 20, 150, 260},
  193.     rUserAlert,
  194.     { /* array: 4 elements */
  195.         /* [1] */
  196.         OK, visible, silent,
  197.         /* [2] */
  198.         OK, visible, silent,
  199.         /* [3] */
  200.         OK, visible, silent,
  201.         /* [4] */
  202.         OK, visible, silent
  203.     }
  204. };
  205.  
  206.  
  207. resource 'DITL' (rUserAlert, purgeable) {
  208.     { /* array DITLarray: 3 elements */
  209.         /* [1] */
  210.         {80, 150, 100, 230},
  211.         Button {
  212.             enabled,
  213.             "OK"
  214.         },
  215.         /* [2] */
  216.         {10, 60, 60, 230},
  217.         StaticText {
  218.             disabled,
  219.             "Error. ^0."
  220.         },
  221.         /* [3] */
  222.         {8, 8, 40, 40},
  223.         Icon {
  224.             disabled,
  225.             2
  226.         }
  227.     }
  228. };
  229.  
  230.  
  231. resource 'WIND' (rDocWindow, preload, purgeable) {
  232.     {64, 60, 314, 460},
  233.     zoomDocProc, invisible, goAway, 0x0, "untitled"
  234. };
  235.  
  236.  
  237. resource 'CNTL' (rVScroll, preload, purgeable) {
  238.     {-1, 385, 236, 401},
  239.     0, visible, 0, 0, scrollBarProc, 0, ""
  240. };
  241.  
  242.  
  243. resource 'CNTL' (rHScroll, preload, purgeable) {
  244.     {235, -1, 251, 386},
  245.     0, visible, 0, 0, scrollBarProc, 0, ""
  246. };
  247.  
  248. resource 'STR#' (kErrStrings, purgeable) {
  249.     {
  250.     "You must run on 512Ke or later";
  251.     "Application Memory Size is too small";
  252.     "Not enough memory to run TESample";
  253.     "Not enough memory to do Cut";
  254.     "Cannot do Cut";
  255.     "Cannot do Copy";
  256.     "Cannot exceed 32,000 characters with Paste";
  257.     "Not enough memory to do Paste";
  258.     "Cannot create window";
  259.     "Cannot exceed 32,000 characters";
  260.     "Cannot do Paste"
  261.     }
  262. };
  263.  
  264. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  265.  
  266. resource 'SIZE' (-1) {
  267.     dontSaveScreen,
  268.     acceptSuspendResumeEvents,
  269.     enableOptionSwitch,
  270.     canBackground,                /* we can background; we don't currently, but our sleep value */
  271.                                 /* guarantees we don't hog the Mac while we are in the background */
  272.     multiFinderAware,            /* this says we do our own activate/deactivate; don't fake us out */
  273.     backgroundAndForeground,    /* this is definitely not a background-only application! */
  274.     dontGetFrontClicks,            /* change this is if you want "do first click" behavior like the Finder */
  275.     ignoreChildDiedEvents,        /* essentially, I'm not a debugger (sub-launching) */
  276.     not32BitCompatible,            /* this app should not be run in 32-bit address space */
  277.     reserved,
  278.     reserved,
  279.     reserved,
  280.     reserved,
  281.     reserved,
  282.     reserved,
  283.     reserved,
  284.     kPrefSize * 1024,
  285.     kMinSize * 1024    
  286. };
  287.  
  288.  
  289. type 'MOOT' as 'STR ';
  290.  
  291.  
  292. resource 'MOOT' (0) {
  293.     "MultiFinder-Aware TextEdit Sample Application"
  294. };
  295.  
  296.  
  297. resource 'BNDL' (128) {
  298.     'MOOT',
  299.     0,
  300.     {
  301.         'ICN#',
  302.         {
  303.             0, 128
  304.         },
  305.         'FREF',
  306.         {
  307.             0, 128
  308.         }
  309.     }
  310. };
  311.  
  312.  
  313. resource 'FREF' (128) {
  314.     'APPL',
  315.     0,
  316.     ""
  317. };
  318.  
  319.  
  320. resource 'ICN#' (128) {
  321.     { /* array: 2 elements */
  322.         /* [1] */
  323.         $"04 30 40 00 0A 50 A0 00 0B 91 10 02 08 22 08 03"
  324.         $"12 24 04 05 20 28 02 09 40 10 01 11 80 0C 00 A1"
  325.         $"80 03 FF C2 7E 00 FF 04 01 00 7F 04 03 00 1E 08"
  326.         $"04 E0 00 0C 08 E0 00 0A 10 E0 00 09 08 C0 00 06"
  327.         $"04 87 FE 04 02 88 01 04 01 88 00 84 00 88 00 44"
  328.         $"00 88 00 44 00 88 00 C4 01 10 01 88 02 28 03 10"
  329.         $"01 C4 04 E0 00 02 08 00 73 BF FB EE 4C A2 8A 2A"
  330.         $"40 AA AA EA 52 AA AA 24 5E A2 8A EA 73 BE FB 8E",
  331.         /* [2] */
  332.         $"04 30 40 00 0E 70 E0 00 0F F1 F0 02 0F E3 F8 03"
  333.         $"1F E7 FC 07 3F EF FE 0F 7F FF FF 1F FF FF FF BF"
  334.         $"FF FF FF FE 7F FF FF FC 01 FF FF FC 03 FF FF F8"
  335.         $"07 FF FF FC 0F FF FF FE 1F FF FF FF 0F FF FF FE"
  336.         $"07 FF FF FC 03 FF FF FC 01 FF FF FC 00 FF FF FC"
  337.         $"00 FF FF FC 00 FF FF FC 01 FF FF F8 03 EF FF F0"
  338.         $"01 C7 FC E0 00 03 F8 00 73 BF FB EE 7F BE FB EE"
  339.         $"7F BE FB EE 7F BE FB E4 7F BE FB EE 73 BE FB 8E"
  340.     }
  341. };
  342.  
  343.